package com.sc.nft.admin.rpc;

import com.sc.nft.entity.StaticData;
import com.sc.nft.service.StaticDataService;
import com.sc.nft.sup.Result;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/rpc/staticData")
public class StaticDataRpc {



    private final StaticDataService staticDataService;

    @ApiOperation(value = "按键获取资源", notes = "初始化holdToken", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/getResourcesByKey", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public Result<StaticData> getResourcesByKey(@RequestBody String key) {
        StaticData byType = staticDataService.getByType(key);
        return Result.success(byType);
    }

}
